//package com.yunxin.admin.system.api.core.channel;
//
//import com.yunxin.admin.system.infra.common.constant.SecurityConstants;
//import com.yunxin.admin.system.infra.framework.resubmit.Resubmit;
//import com.yunxin.admin.system.infra.framework.security.util.SecurityUtils;
//import com.yunxin.admin.system.infra.framework.syslog.AutoLog;
//import com.yunxin.common.result.PageResult;
//import com.yunxin.common.result.Result;
//import com.yunxin.core.application.command.channel.*;
//import com.yunxin.core.application.dto.channel.*;
//import com.yunxin.core.application.service.ChannelApplicationAdminService;
//import com.yunxin.core.application.service.ChannelQueryAdminService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.security.SecurityRequirement;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * @author zero°
// * @since 2023-05-29
// */
//@Tag(name = "11.渠道管理")
//@Slf4j
//@RestController
//@RequestMapping("/core/v1/channel")
//@RequiredArgsConstructor
//public class ChannelController {
//
//    private final ChannelQueryAdminService channelQueryAdminService;
//
//    private final ChannelApplicationAdminService channelApplicationAdminService;
//
//    @Operation(summary = "新增渠道", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/addChannel")
//    @PreAuthorize("@ss.hasPerm('core:channel:add')")
//    @Resubmit
//    @AutoLog(value = "新增渠道")
//    public Result<Boolean> addChannel(@Validated @RequestBody AddChannelCommand command) {
//        command.setCreator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(channelApplicationAdminService.addChannel(command));
//    }
//
//    @Operation(summary = "更新渠道", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateChannel")
//    @PreAuthorize("@ss.hasPerm('core:channel:edit')")
//    @Resubmit
//    @AutoLog(value = "更新渠道")
//    public Result<Boolean> updateChannel(@Validated @RequestBody UpdateChannelCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(channelApplicationAdminService.updateChannel(command));
//    }
//
//    @Operation(summary = "根据id获取渠道信息", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getChannelDetail/{id}")
//    public Result<ChannelDetailDTO> getChannelDetail(@Parameter(description = "渠道id") @PathVariable Long id) {
//        ChannelDetailDTO result = channelQueryAdminService.getChannelDetail(id);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "获取渠道下拉列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listChannel")
//    public Result<List<ChannelListDTO>> listChannel() {
//        List<ChannelListDTO> result = channelQueryAdminService.listChannel();
//        return Result.success(result);
//    }
//
//    @Operation(summary = "分页查询渠道列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/channelPageQuery")
//    public PageResult<ChannelPageDTO> channelPageQuery(@Validated @RequestBody ChannelPageCommand command) {
//        return channelQueryAdminService.channelPageQuery(command);
//    }
//
//    @Operation(summary = "新增渠道预付款记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/addChannelAdvanceChargeRecord")
//    @PreAuthorize("@ss.hasPerm('core:channel:advance:charge:add')")
//    @Resubmit
//    @AutoLog(value = "新增渠道预付款记录")
//    public Result<Boolean> addChannelAdvanceChargeRecord(@Validated @RequestBody AddChannelAdvanceChargeRecordCommand command) {
//        command.setCreator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(channelApplicationAdminService.addChannelAdvanceChargeRecord(command));
//    }
//
//    @Operation(summary = "更新渠道预付款记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateChannelAdvanceChargeRecord")
//    @PreAuthorize("@ss.hasPerm('core:channel:advance:charge:edit')")
//    @Resubmit
//    @AutoLog(value = "更新渠道预付款记录")
//    public Result<Boolean> updateChannelAdvanceChargeRecord(@Validated @RequestBody UpdateChannelAdvanceChargeRecordCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(channelApplicationAdminService.updateChannelAdvanceChargeRecord(command));
//    }
//
//    @Operation(summary = "根据id获取渠道预付款信息记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getChannelAdvanceChargeRecordDetail/{id}")
//    public Result<ChannelAdvanceChargeRecordDetailDTO> getChannelAdvanceChargeRecordDetail(@Parameter(description = "id") @PathVariable Long id) {
//        ChannelAdvanceChargeRecordDetailDTO result = channelQueryAdminService.getChannelAdvanceChargeRecordDetail(id);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "分页查询渠道预付款记录列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/channelAdvanceChargeRecordPageQuery")
//    public PageResult<ChannelAdvanceChargeRecordPageDTO> channelAdvanceChargeRecordPageQuery(@Validated @RequestBody ChannelAdvanceChargeRecordPageCommand command) {
//        return channelQueryAdminService.channelAdvanceChargeRecordPageQuery(command);
//    }
//
//    @Operation(summary = "渠道预付款记录统计", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/channelAdvanceChargeRecordStatistics")
//    public Result<ChannelAdvanceChargeRecordStatisticsDTO> channelAdvanceChargeRecordStatistics(@Validated @RequestBody ChannelAdvanceChargeRecordPageCommand command) {
//        return Result.success(channelQueryAdminService.channelAdvanceChargeRecordStatistics(command));
//    }
//
//    @Operation(summary = "分页查询渠道预付款列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/channelAdvanceChargePageQuery")
//    public PageResult<ChannelAdvanceChargePageDTO> channelAdvanceChargePageQuery(@Validated @RequestBody ChannelAdvanceChargePageCommand command) {
//        return channelQueryAdminService.channelAdvanceChargePageQuery(command);
//    }
//
//}
